package com.zego.wawaji.ui.bean.banner;

import com.zego.wawaji.base.data.BaseData;

import org.json.JSONArray;

import java.util.ArrayList;
import java.util.List;

/**
 * 轮播公告
 * Created by Su on 2017/12/4.
 */
public class NoticeList extends BaseData {
    private List<Notice> noticeList = new ArrayList<>();
    private List<String> noticeImg = new ArrayList<>();
    private List<String> noticeLink = new ArrayList<>();

    @Override
    public void parseJson(String jsonStr) {
        JSONArray jsonArray = getJsonArray(jsonStr);
        this.noticeList = (List<Notice>) getBaseDataList(jsonArray, Notice.class);
    }

    /**
     * 获取活动页图片地址
     */
    public List<String> getNoticeImg() {
        if (noticeList == null) return noticeImg;
        for (Notice notice : noticeList) {
            noticeImg.add(notice.getImg());
        }
        return noticeImg;
    }

    /**
     * 获取H5连接地址
     */
    public List<String> getNoticeLink() {
        if (noticeList == null) return noticeLink;
        for (Notice notice : noticeList) {
            noticeLink.add(notice.getLink());
        }
        return noticeLink;
    }

    public List<Notice> getNoticeList() {
        return noticeList;
    }
}
